package org.linlinjava.litemall.admin.service;

import org.linlinjava.litemall.db.dao.LitemallBookListMapper;
import org.linlinjava.litemall.db.domain.LitemallBookList;
import org.linlinjava.litemall.db.service.LitemallBookListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Administrator
 */
@Service
public class AdminBookListService {
    @Autowired
    private LitemallBookListMapper bookListMapper;
    @Autowired
    private LitemallBookListService bookListService;

    /**
     * 创建书单
     * @param bookList
     * @return
     */
    public void create(LitemallBookList bookList) {
        bookListService.add(bookList);
    }

    /**
     * 修改书单
     * @param bookList
     * @return
     */
    public Object update(LitemallBookList bookList) {
        return bookListService.updateById(bookList);
    }

    /**
     * 删除某个书单
     * @param bookListId
     * @return
     */
    public Object delete(Integer bookListId) {
        return bookListMapper.deleteByPrimaryKey(bookListId);
    }

    /**
     * 分页展示所有书单列表
     * @param type
     * @param offset
     * @param limit
     * @param sort
     * @param order
     * @return
     */
    public Object list(int type,int offset, int limit, String sort, String order) {
        return bookListService.queryList(type, offset, limit, sort, order);
    }

    /**
     * 查看某个具体的书单
     * @param bookListId
     * @return
     */
    public Object findOne(Integer bookListId) {
        return bookListService.findById(bookListId);
    }




}
